<template>
  <div class="serve-container">
    <div class="card-container">
      <div class="card" v-for="item in funcList" :key="item.id" @click="toFunc(item.url)">
        <div class="image"><img class="image" :src="getImg(item.img)" /></div>
        <span class="title"> {{ item.title }} </span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      funcList: [
        {
          id: 1,
          url: '/lookPersonalInfo',
          img: 'seePersonalInfo.png',
          title: '个人信息查看'
        },
        {
          id: 2,
          url: '/changePersonalInfo',
          img: 'changePersonal.png',
          title: '修改个人信息'
        },
        { id: 3, url: '/changePwd', img: 'changePwd.png', title: '修改密码' },
        { id: 4, url: '/applyCampus', img: 'apply2.png', title: '一卡通申请' },
        { id: 5, url: '/lostCampus', img: 'lost.png', title: '一卡通挂失' },
        { id: 6, url: '/chargeCampus', img: 'charge.png', title: '一卡通充值' },
        {
          id: 7,
          url: '/waterAndElectricity',
          img: 'waterAndElectricity.png',
          title: '水电缴费'
        },
        { id: 8, url: '/chargeNet', img: 'net.png', title: '网络缴费' },
        { id: 9, url: '/consume', img: 'supermarket.png', title: '餐超消费' },
        { id: 10, url: '/myBill', img: 'myBill.png', title: '我的账单' },
        {
          id: 11,
          url: '/suggestion',
          img: 'suggestion.png',
          title: '反馈建议'
        },
        { id: 12, url: '/lostAndFound', img: 'lostItem.png', title: '失物招领' }
      ]
    }
  },
  methods: {
    getImg(src) {
      return require('@/assets/img/index/' + src)
    },
    toFunc(val) {
      this.$router.push(val)
    }
  }
}
</script>

<style lang="less" scoped>
.serve-container {
  .card-container {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    .card {
      box-sizing: border-box;
      flex: 0 0 30%;
      box-shadow: none;
      // transition: box-shadow 0.5s;
      margin: 10px;
      border: 2px solid #ececec;
      border-radius: 10px;
      width: 250px;
      height: 250px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-direction: column;
      .image {
        width: 100px;
        height: 100px;
        padding-bottom: 50px;
        img {
          width: 100%;
          height: 100%;
        }
      }
      .title {
        font-size: 20px;
        font-weight: bold;
        color: gray;
      }
    }
    .card:hover {
      border: 2px solid #3a62d7;
      transform: translateY(-10px);
      transition: 0.5s;
      box-shadow: #ccc 0px 10px 10px;
      cursor: pointer;
      .title {
        color: #3a62d7;
        transition: 1s;
      }
    }
  }
}
</style>
